package com.fy.entity;


import com.alibaba.excel.annotation.ExcelIgnore;
import com.fasterxml.jackson.annotation.JsonIgnore;
import lombok.Data;

import java.io.Serializable;
import java.util.ArrayList;
import java.util.List;

@Data
public class BaseEntity implements Serializable {

    @JsonIgnore
    @ExcelIgnore
    private Integer pageNum;

    @JsonIgnore
    @ExcelIgnore
    private Integer pageSize;

    @JsonIgnore
    @ExcelIgnore
    private String redisKey;

    //用户姓名
    private String userName;

    //开始时间
    @JsonIgnore
    private String startDateParam;
    //结束时间
    @JsonIgnore
    private String endDateParam;
    @JsonIgnore
    private String dataSql;

    private Integer id;
    private Integer parentId;
    private List<BaseEntity> child;

    @JsonIgnore
    private String content;

    public <T extends BaseEntity> void addChild(BaseEntity  baseTreeNode) {
        if (this.child == null) {
            this.setChild(new ArrayList());
        }

        this.getChild().add(baseTreeNode);
    }

    public Integer getPageNum() {
        return pageNum == null? 1 : pageNum;
    }

    public void setPageNum(Integer pageNum) {
        this.pageNum = pageNum;
    }

    public Integer getPageSize() {
      return pageSize == null ? 9999 : pageSize;
    }

    public void setPageSize(Integer pageSize) {
        this.pageSize = pageSize;
    }


    public String getRedisKey() {
        return redisKey;
    }

    public void setRedisKey(String redisKey) {
        this.redisKey = redisKey;
    }
}
